import Vue from 'vue';
import Router from 'vue-router';



Vue.use(Router);

// 登录页面
const Login = resolve => require(['../container/other/Login.vue'], resolve);
// 404页面
const NotFound = resolve => require(['../container/other/404.vue'], resolve);
const Home = resolve => require(['../components/common/Home.vue'], resolve);

const PersonalInfo = resolve => require(['../container/PersonalInfo.vue'], resolve);
const PersonalCenter = resolve => require(['../container/PersonalCenter.vue'], resolve);
const ViewMeaasge = resolve => require(['../container/ViewMeaasge.vue'], resolve);
const ViewEquipment = resolve => require(['../container/ViewEquipment.vue'], resolve);
const ViewCustomer = resolve => require(['../container/ViewCustomer.vue'], resolve);
const ViewRepairList = resolve => require(['../container/ViewRepairList.vue'], resolve);
const Achievements = resolve => require(['../container/Achievements.vue'], resolve);

export default new Router({
    routes: [
        // !登录页面
        {
            path: '/',
            name: 'Login',
            component: Login,
            meta: {
                title: '登录'
            }
        }, {
            component: Home,
            path: '/Home',
            redirect: '/personalInfo',
            children: [
                {
                    path: '/personalInfo',
                    name: 'PersonalInfo',
                    component: PersonalInfo,
                    meta: {
                        title: '个人资料',
                        belong: 'personalInfo'
                    }
                }, {
                    path: '/personalCenter',
                    name: 'PersonalCenter',
                    component: PersonalCenter,
                    meta: {
                        title: '个人中心',
                        belong: 'personalCenter'
                    }
                }, {
                    path: '/viewMeaasge',
                    name: 'ViewMeaasge',
                    component: ViewMeaasge,
                    meta: {
                        title: '查看消息',
                        belong: 'viewMeaasge'
                    }
                }, {
                    path: '/viewEquipment',
                    name: 'ViewEquipment',
                    component: ViewEquipment,
                    meta: {
                        title: '查看设备',
                        belong: 'viewEquipment'
                    }
                }, {
                    path: '/viewCustomer',
                    name: 'ViewCustomer',
                    component: ViewCustomer,
                    meta: {
                        title: '查看客户',
                        belong: 'viewCustomer'
                    }
                }, {
                    path: '/viewRepairList',
                    name: 'ViewRepairList',
                    component: ViewRepairList,
                    meta: {
                        title: '查看维修单',
                        belong: 'viewRepairList'
                    }
                }, {
                    path: '/achievements',
                    name: 'Achievements',
                    component: Achievements,
                    meta: {
                        title: '绩效',
                        belong: 'achievements'
                    }
                },
            ]
        }, {
            path: '*',
            component: NotFound,
            meta: {
                title: '找不到页面'
            }
        }
    ]
})
